package com.stark.blog;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.stark.blog.model.User;
public class TestDB {

	public static void main(String[] args) throws SQLException {
		String sql="select id,name,password,email,tel,pic,created_time from user where id=1";
		Connection conn =DBUtil.getConnection();
		PreparedStatement ps=DBUtil.getPSMT(conn, sql);
		ResultSet rs=DBUtil.getExecuteQueryResultSet(ps);
		User u=null;
		while(rs.next()){
			u=new User();
			u.initUserForms(rs);
		}
		
		
			System.out.println("UserId:"+u.getEmail());
		
	}
		/*String sql ="insert into user(name,password,email,tel) values(?,?,?,?)";
		String[] params={"wy","wy","123","3212"};
		Connection conn=DBUtil.getConnection();
		PreparedStatement ps=DBUtil.getPSMTWithConnection(conn,sql);
		ps.setString(1, "wy");
		ps.setString(2, "wy");
		ps.setString(3, "123");
		ps.setString(4, "321");
		int i=ps.executeUpdate();
		DBUtil.close(conn, ps);
		System.out.println(i);*/
}
